package com.book;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

@SpringBootTest
public class test {
    @Test
    void test1(){
//        String rawPassword = "123456";
//        String encodedPassword = new BCryptPasswordEncoder().encode(rawPassword);
//        System.out.println("正确的BCrypt哈希值: " + encodedPassword);
        String rawPassword = "123456";
        String encodedPassword = "$2a$10$01t9S78ooJbEm8POLn8T9enUxCzLczy3S9XvHDK2ZKjJ1Obe415ou";
        boolean isMatch = new BCryptPasswordEncoder().matches(rawPassword, encodedPassword);
        System.out.println("密码是否匹配: " + isMatch); // 应该输出 true
    }
}
